package cn.tedu.spring2205.week01.demo02.service.impl;

import cn.tedu.spring2205.week01.demo02.dao.CatDao;
import cn.tedu.spring2205.week01.demo02.dao.UserDao;
import cn.tedu.spring2205.week01.demo02.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

//    @Autowired
//    @Qualifier("userDaoImpl")
//    private UserDao userDao;

    //构造方法注入 -- @Qualifier注解不能用于构造方法上方
//    @Qualifier("catDaoImpl")
//    public UserServiceImpl(CatDao catDao){
//
//    }

    private UserDao userDao;

    @Autowired
    public void setUserDao(@Qualifier("userDaoImpl") UserDao userDao){
        this.userDao = userDao;
    }

    @Override
    public UserDao getUserDao() {
        return this.userDao;
    }
}
